import http from "../Util/request";

export const Login = (params) => {
  return http.post("/login", params);
};

/**
 * 获取用户更详细信息
 */
export const getUserInfo = () => {
  return http.get("/sys/profile");
};

// 休假 请假 添加信息接口

export const addleaveinfo = (data) => {
  return http({
    url: "/sys/addleaveinfo",
    method: "post",
    data: {
      data: data,
    },
  });
};

export const showleaveinfo = () => {
  return http({
    url: "/sys/showleaveinfo",
    method: "get",
  });
};
export const findleaveinfo = (query) => {
  return http({
    url: "/sys/findleaveinfo",
    method: "get",
    params: query,
  });
};

export const delleaveinfo2 = (data) => {
  return http({
    url: "/sys/delleaveinfo",
    method: "post",
    data: {
      _id: data,
    },
  });
};

export const updateleaveinfo2 = (data) => {
  return http({
    url: "/sys/updateleaveinfo",
    method: "post",
    data: {
      data: data,
    },
  });
};

// 员工
export const getUserInfoList = (query) => {
  return http({
    url: "/sys/userlist",
    method: "get",
    params: query, //前端分页数据
  });
};
// 用户
export const getUserInfoList2 = (query) => {
  return http({
    url: "/sys/userlist2",
    method: "get",
    params: query, //前端分页数据
  });
};

// 修改用户
export const updateuser = (data) => {
  return http({
    url: "/sys/updateuser",
    method: "post",
    data: {
      data: data,
    },
  });
};
// 修改员工
export const updateEmp = (data) => {
  return http({
    url: "/sys/update",
    method: "post",
    data: {
      data: data,
    },
  });
};

// 查员工
export const getUsersearch = (query) => {
  return http({
    url: "/sys/getUsersearch",
    method: "get",
    params: {
      mobile: query,
    },
  });
};
// 查用户
export const getUsersearch2 = (query) => {
  return http({
    url: "/sys/getUsersearch2",
    method: "get",
    params: {
      mobile: query,
    },
  });
};

// 添加用户
export const addUser = (data) => {
  return http({
    url: "/sys/adduser",
    method: "post",
    data,
  });
};
// 删除用户
export const delUser = (data) => {
  return http({
    url: "/sys/deluser",
    method: "post",
    data: { data },
  });
};

// 添加员工
export const addEmployee = (data) => {
  return http({
    url: "/sys/addemployee",
    method: "post",
    data,
  });
};

// 删除员工
export const delEmployee = (data) => {
  return http({
    url: "/sys/delemp",
    method: "post",
    data: { data },
  });
};

// 电影相关
export const addfilminfo = (data) => {
  return http({
    url: "sys/addfilminfo",
    method: "post",
    data: {
      data: data,
    },
  });
};

export const searchfilm = () => {
  return http({
    url: "sys/searchfilm",
    method: "get",
  });
};

export const delfilm = (data) => {
  return http({
    url: "/sys/delfilm",
    method: "post",
    data: {
      data,
    },
  });
};
// 分页
export const findfilminfo = (data) => {
  return http({
    url: "/sys/findfilminfo",
    method: "get",
    params: data,
  });
};
export const searchfilmname = (data) => {
  return http({
    url: "/sys/searchfilmname",
    method: "get",
    params: { data },
  });
};

export const updatefilminfo = (data) => {
  return http({
    url: "/sys/updatefilminfo",
    method: "post",
    data,
  });
};

// 富文本
// export const richtext = (data) => {
//   return http({
//     url: "/sys/richtext",
//     method: "post",
//     params: { data },
//   });
// };

export const richtext = (data) => http.post("/sys/richtext", { data });
